package com.ltu.base;


import com.ltu.base.GenericEntity;

@SuppressWarnings("serial")
public class State extends GenericEntity {  

	public static final Integer CODE_SUCCESS = 200;//成功
	public static final Integer CODE_FAILED = 500;//失败，具体原因看message
	public static final Integer CODE_VALIDATE_FAILED = 404;//地址不对
	public static final Integer CODE_UNAUTHORIZED = 401;//登录过期
	public static final Integer CODE_FORBIDDEN = 403;//无权限
	public static final Integer CODE_USER_EXIST = 601;
	public static final Integer CODE_USER_BAN = 602;

	public static final State SUCCESS = new State(CODE_SUCCESS,"成功");
	public static final State FAILED = new State(CODE_FAILED,"发生错误");
	public static final State VALIDATE_FAILED = new State(CODE_VALIDATE_FAILED,"参数不正确");
	public static final State UNAUTHORIZED = new State(CODE_UNAUTHORIZED,"未登录或登录过期");
	public static final State FORBIDDEN = new State(CODE_FORBIDDEN,"无权限访问");
	public static final State USERBAN = new State(CODE_USER_BAN,"用户已禁用");
	public static final State RETRY = new State(CODE_USER_BAN,"人数过多，请稍后重试");
	public static final State AMOUNTERROR = new State(CODE_FAILED,"库存不足");

	
	
	
	public enum stateDict{
		VERIFY_USER(50001,"用户不存在"),
		;				
		 private int index;
		 private String value;
		 
		 stateDict(int index,String value){
			 this.index=index;
			 this.value=value;
		 }

		public int getIndex() {
			return index;
		}

		public String getValue() {
			return value;
		}
	}

	private Integer code;
	private String message;

	public State() {
		super();
	}

	public State(Integer code, String message) {
		super();
		this.code = code;
		this.message = message;
	}

	public Integer getCode() {
		return code;
	}

	public void setCode(Integer code) {
		this.code = code;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

}
